home *** CD-ROM | disk | FTP | other *** search
- Path: Inter.NL.net!usenet
- From: Auke.Reitsma@net.HCC.nl (Auke Reitsma)
- Newsgroups: comp.lang.c
- Subject: Re: Limiting stdin input to "n" chars
- Date: Fri, 15 Mar 1996 18:56:25 GMT
- Organization: Inter.NL.net, The Internet Provider in The Netherlands.
- Message-ID: <4icer1$df5@altrade.nijmegen.inter.nl.net>
- References: <4hqfmc$un7@thorn.cc.usm.edu>
- Reply-To: Auke.Reitsma@net.HCC.nl
- NNTP-Posting-Host: rt99-4.rotterdam.nl.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- rmfulce@ocean.st.usm.edu (Mike Fulce) wrote:
-
- > How do you limit the number of characters read from stdin? What I want to do
- > is to automatically do a carriage return after a user enters say.. 2 digits.
- > I've written a few programs using scanf to get input, but it won't work for
- > what I need now. (I think it's because scanf is buffered I/O?).
-
- > Please e-mail all responses to me and I will post a summary.
-
- Do character by character input with e.g. getch() or getchar()
- /* (Non-ISO/ANSI) */ or fgetc( stdin ) /* ISO/ANSI */
- Or use fgets( your_buffer, number_of_chars, stdin ) /* ANSI */
-
-
- Greetings from Delft, The Netherlands.
-
- Auke Reitsma
-
-